package Envo 
{
	import flash.display.MovieClip;
	
	/**
	 * ...
	 * @author Sam Morrison
	 */
	public class Animation extends MovieClip 
	{
		
		public function Animation() 
		{
			
		}
		
		public function update(player:Player):void
		{
			if (player.movingLeft)
			{
				player.gotoAndPlay("left");
			}
			else if (player.movingRight)
			{
				player.gotoAndPlay("right");
			}
			else
			{
				if (player.facing == "left")
				{
					player.gotoAndPlay("idleLeft");
				}
				else
				{
					player.gotoAndPlay("idleRight");
				}
			}
			
			if (player.collidingVertical == "none"
				|| player.collidingVertical == "top")
			{
				if (player.facing == "left")
				{
					player.gotoAndPlay("jumpLeft");
				}
				else
				{
					player.gotoAndPlay("jumpRight");
				}
			}
			
			if (player.collidingHorizontal == "left"
				&& (player.collidingVertical == "none"
				|| player.collidingVertical == "top"))
			{
				player.gotoAndPlay("leftWallSlide");
			}
			else if (player.collidingHorizontal == "right"
				&& (player.collidingVertical == "none"
				|| player.collidingVertical == "top"))
			{
				player.gotoAndPlay("rightWallSlide");
			}
			
			
			
			
		}
		
	}

}